/**
* AutoSWF - Cody Cushing. March 26, 2009
* Copyright (c) 2009 Cody Cushing
* No use restrictions. Maintain this notice in all versions. 
**/

package com.autoswf.lattice
{
	import flash.events.Event;
	import flash.events.IOErrorEvent;
	import flash.net.URLLoader;
	import flash.net.URLRequest;


	/**
	 * Lattice node for loading data. 
	 */
	public class URLLoaderLattice extends AsyncLattice
	{
		protected var _urlLoader:URLLoader;
		public function get urlLoader():URLLoader
		{
			return _urlLoader;
		}
		
		public function URLLoaderLattice(url:String)
		{
			_urlLoader = new URLLoader();
			
			onExecute(_urlLoader.load, new URLRequest(url));
			watch(_urlLoader).completeTriggers(Event.COMPLETE).cancelTriggers(IOErrorEvent.IO_ERROR);
		}
	}
}